<%@ page import="db.User" %>
<%@ page import="db.DBConnection" %>
<%--
  Created by IntelliJ IDEA.
  User: SLeeP
  Date: 29.04.12
  Time: 4:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>User information</title>
    <%
        int user_id = -1;
        Cookie[] cookies = request.getCookies();
        for (Cookie cookie : cookies) {
            if (cookie.getName().equals("user_id")) {
                user_id = Integer.parseInt(cookie.getValue());
            }
        }
        DBConnection dbConnection = new DBConnection();
        User user = null;
        if (user_id != -1) {
             user = dbConnection.getUserInfo(user_id, user_id);
        } else {
        %> <meta http-equiv="Refresh" content="0; url=accounts.jsp"> <%
        }
%>

</head>
<body>
    <h3>Personal data</h3>
    <table bgcolor="#d3d3d3">
        <tr>
            <td>Name</td>
            <td><%= user.name%></td>
        </tr>
        <tr>
            <td>Date of birth</td>
            <td><%= user.birthDate%></td>
        </tr>
        <tr>
            <td>Country</td>
            <td><%= user.country %></td>
        </tr>
        <tr>
            <td>City </td>
            <td><%= user.city%></td>
        </tr>
        <tr>
            <td>Address</td>
            <td><%= user.address%></td>
        </tr>
    </table>

</body>
</html>